using System.Collections.Generic;

namespace Commons.Models.Settings.Parsers
{
	public class ParserContext
	{
		private const string SettingsModelKey = "settingsModel";

		private Dictionary<string, object> data = new Dictionary<string, object>();

		public ParserContext(ISettingsModel settingsModel)
		{
			data.Add(SettingsModelKey, settingsModel);
		}

		public ISettingsModel SettingsModel
		{
			get
			{
				return (ISettingsModel) data[SettingsModelKey];
			}
		}

		public object this[string key]
		{
			get
			{
				object value;

				return data.TryGetValue(key, out value) ? value : null;
			}
			set
			{
				data.Add(key, value);
			}
		}
	}
}
